package com.xiaohang.springstudy.chapter1;

import com.xiaohang.springstudy.chapter1.rest.UserController;
import com.xiaohang.springstudy.chapter1.utils.IdCardUtil;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;

import java.sql.Date;
import java.time.LocalDate;

@RunWith(SpringRunner.class)// 引入spring对JUnit的支持
//@SpringBootTest(classes = Chapter1Application.class)// 指定springboot启动类
@ActiveProfiles(profiles = "dev")
/**
 * 单纯Junit测试，不模拟Http调用请求
 */
public class Chapter1ApplicationTest2 {

    @Test
    public void testUserController() {
        String generate = IdCardUtil.generate();
        System.out.println(generate);
        String generate1 = IdCardUtil.generate("110000", Date.valueOf(LocalDate.now()), true);
        System.out.println(generate1);
    }

}